#FROM centos:centos7.9.2009
#FROM registry.cn-hangzhou.aliyuncs.com/baimeidashu/bmds:centos-centos7.9.2009
FROM registry.cn-hangzhou.aliyuncs.com/baimeidashu/bmds:centos7.9.2009-for-nginx-bianyi-v1.0
MAINTAINER zhaozhiyong  "715740383@qq.com"


# 获取 reqstat 模块源码

COPY ./ngx_req_status-master /tmp/ngx_req_status-master
COPY ./nginx-1.28.0 /tmp/nginx-1.28.0

RUN cd /tmp && \
    cd nginx-1.28.0 && \
	patch -p1 < /tmp/ngx_req_status-master/write_filter-1.7.11.patch

# 下载并编译 Nginx 1.26.0 源码（带 reqstat 模块）
RUN cd /tmp && \
    cd nginx-1.28.0 && \
    ./configure \
        --prefix=/etc/nginx \
        --sbin-path=/usr/sbin/nginx \
        --modules-path=/usr/lib/nginx/modules \
        --conf-path=/etc/nginx/nginx.conf \
        --error-log-path=/var/log/nginx/error.log \
        --http-log-path=/var/log/nginx/access.log \
        --pid-path=/var/run/nginx.pid \
        --lock-path=/var/run/nginx.lock \
        --add-module=/tmp/ngx_req_status-master && \
    make && \
    make install

# 清理编译文件
RUN rm -rf /tmp/nginx-* /tmp/ngx_req_status-master

# 设置工作目录
WORKDIR /etc/nginx
#当前使用 CMD ["tail","-f","/etc/hosts"] 仅用于调试
CMD ["tail","-f","/etc/hosts"]


#实际部署时应改为 CMD ["nginx", "-g", "daemon off;"]

#CMD ["nginx", "-g", "daemon off;"]